<?php
require_once("Library/class.phphome.php");

$x = new APICore;

if (!empty($_FILES)) {
    $append_file_name= 0;       //  0 for do not append file name - 1 for append file name
    $maxflsz = 1000000;       //  maximum file size allowed for upload - 1000000 = 1MB
    $xt = array("png", "gif", "jpeg", "jpe", "jpg");       //  separate file extensions allowed with a comma
    

    $selfpth=explode("/",$upldpth);
    $selfpth[count($selfpth)-1]="";
    $upldpth=implode("/",$selfpth);
	$access = $_FILES['Filedata']['error'];
	if (!$access){	

		$filename = $_FILES ['Filedata']['name'];

		for($i = 0; $i < count($xt); $i++){
			if(eregi("\.". $xt[$i] ."$", $filename)){
				$validext=1;
				$fileext=$xt[$i];
			}
		}

			if($append_file_name){
				$tmp=explode(".", $filename);
				$flnm=$flnm."_".$tmp[0];		
			}
			move_uploaded_file ($_FILES['Filedata']['tmp_name'], "Files/img/".$filename);
			echo "1";
	}
}
?>